import React, {Component} from 'react';
import PropTypes from 'prop-types';

import '../comment-item/comment-item.css'
class Item extends Component {
    static propTypes={
        comment:PropTypes.object.isRequired,
        delInfo:PropTypes.func.isRequired,
        index:PropTypes.number.isRequired
    }
    handleClick=()=>{
        const {delInfo,index}=this.props;
        delInfo(index)
    }
    render() {
        const {comment}=this.props;
        return (
            <li className="list-group-item">
                <div className="handle">
                    <a href="javascript:;" onClick={this.handleClick}>删除</a>
                </div>
                <p className="user"><span>{comment.username}</span><span>说:</span></p>
                <p className="centence">{comment.content}</p>
            </li>
        );
    }
}

export default Item;